﻿using System;
using UnityEngine.Rendering;
#if URP
using UnityEngine.Rendering.Universal;
#endif

#if HDRP
using UnityEngine.Rendering.HighDefinition;
#endif

/// <summary>
/// 渲染管线类型
/// </summary>
public enum en_ESF_RenderPipelineClassify
{ 
    /// <summary>
    /// 内置渲染管线
    /// </summary>    
    [ESF_AliasTooltip("内置渲染管线")]
    BuildIn,
    /// <summary>
    /// URP渲染管线
    /// </summary>    
    [ESF_AliasTooltip("Universal Render Pipeline")]
    URP,
    /// <summary>
    /// HDRP渲染管线
    /// </summary>    
    [ESF_AliasTooltip("High Definition Render Pipeline")]
    HDRP,
}

/// <summary>
/// 全局工具
/// </summary>
public static partial class ESF_GlobalUtility
{
#region ESF_GetRenderPipeline 获得当前渲染管线
    /// <summary>
    /// 获得当前渲染管线
    /// </summary>
    /// <returns>渲染管线</returns>
    public static en_ESF_RenderPipelineClassify ESF_GetRenderPipeline()
    {
        RenderPipelineAsset rpa = GraphicsSettings.currentRenderPipeline;
        en_ESF_RenderPipelineClassify result = en_ESF_RenderPipelineClassify.BuildIn;
#if URP
        if (rpa is UniversalRenderPipelineAsset)
        {
            result = en_ESF_RenderPipelineClassify.URP;
        }
#endif

#if HDRP
        if (rpa is HDRenderPipelineAsset)
        {
            result = en_ESF_RenderPipelineClassify.HDRP;
        }      
#endif
        return result;
    }
#endregion
}